using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.Guest;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
namespace BusinessObjects.BO_GetObjects 
{
	public static class BO_Guest
	{
		public static DataTable SelectAll(int status)
		{
			try
			{
				BOGuest_Select_All action = new BOGuest_Select_All();
				usp_Guest_Select_All entity = new usp_Guest_Select_All();
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows, int status)
		{
			try
			{
				BOGuest_Select_Top action = new BOGuest_Select_Top();
				usp_Guest_Select_Top entity = new usp_Guest_Select_Top();
				entity.NUMBERRECORD = rows;
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable Search(int  guest_id)
		{
			try
			{
				BOGuest_Search action = new BOGuest_Search();
				usp_Guest_Search entity = new usp_Guest_Search();
				entity.GUEST_ID = guest_id;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
		{
			try
			{
				BOGuest_Select_WithPaged action = new BOGuest_Select_WithPaged ();
				usp_Guest_Select_WithPaged entity = new usp_Guest_Select_WithPaged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;
				entity.STATUS = status;
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Insert( string ip_address, DateTime first_access, DateTime last_access, int total_access, int total_page_view, int sort_display, string created_by, DateTime modify_date, string modify_by, bool status)
		{
			try
			{
				BOGuest_Insert action = new BOGuest_Insert();
				usp_Guest_Insert entity = new usp_Guest_Insert();
				entity.IP_ADDRESS = ip_address;
				entity.FIRST_ACCESS = first_access;
				entity.LAST_ACCESS = last_access;
				entity.TOTAL_ACCESS = total_access;
				entity.TOTAL_PAGE_VIEW = total_page_view;
				entity.SORT_DISPLAY = sort_display;
				entity.CREATED_BY = created_by;
				entity.MODIFY_DATE = modify_date;
				entity.MODIFY_BY = modify_by;
				entity.STATUS = status;
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Update( Int64 guest_id, string ip_address, DateTime first_access, DateTime last_access, int total_access, int total_page_view, int sort_display, string created_by, DateTime modify_date, string modify_by, bool status)
		{
			try
			{
				BOGuest_Update action = new BOGuest_Update();
				usp_Guest_Update entity = new usp_Guest_Update();
				entity.GUEST_ID = guest_id;
				entity.IP_ADDRESS = ip_address;
				entity.FIRST_ACCESS = first_access;
				entity.LAST_ACCESS = last_access;
				entity.TOTAL_ACCESS = total_access;
				entity.TOTAL_PAGE_VIEW = total_page_view;
				entity.SORT_DISPLAY = sort_display;
				entity.CREATED_BY = created_by;
				entity.MODIFY_DATE = modify_date;
				entity.MODIFY_BY = modify_by;
				entity.STATUS = status;
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Delete(int guest_id)
		{
			try
			{
				BOGuest_Delete action = new BOGuest_Delete();
				usp_Guest_Delete entity = new usp_Guest_Delete();
				entity.GUEST_ID = guest_id;
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Restore(int guest_id)
		{
			try
			{
				BOGuest_Restore action = new BOGuest_Restore();
				usp_Guest_Restore entity = new usp_Guest_Restore();
				entity.GUEST_ID = guest_id;
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}

